import request from "../utils/request";
import {
  IUserSearchParams,
  IUserListResponse,
  IEditUser,
  ICreateUser,
  IRole,
  IUser
} from "../types/user";

export default {
  // 获取所有用户信息
  getUserList(params: IUserSearchParams) {
    return request.get<IUserListResponse>("/users/list", params);
  },
  // 获取用户信息
  getUserInfo() {
    return request.get<IUser>("/users/getUserInfo");
  },
  // 添加用户
  addUser(data: ICreateUser) {
    return request.post("/users/create", data);
  },
  // 编辑用户
  editUser(data: IEditUser) {
    return request.post("/users/edit", data);
  },
  // 删除用户
  deleteUser(data: { userIds: number[] }) {
    return request.post("/users/delete", data);
  },
  // 获取所有角色-alllist
  getAllRoleList() {
    return request.get<IRole[]>("/roles/allList");
  },
};
